package com.oa.service;

import com.oa.dao.DeptDao;
import com.oa.dao.impl.DeptDaoImpl;
import com.oa.pojo.Dept;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author wzm
 * @create 2023-11-13 10:21
 * project_name:web2310
 * @Description
 */
public class DeptServiceImpl implements DeptService{
    private DeptDao deptDao = new DeptDaoImpl();
    @Override
    public List<Dept> findAll() {
        return deptDao.selectByAll();
    }

    @Override
    public Dept findById(int id) {
        return deptDao.selectById(id);
    }

    @Override
    public boolean insert(Dept dept) {
        return deptDao.insert(dept) > 0;
    }

    @Override
    public boolean update(Dept dept) {


        return deptDao.update(dept) > 0;
    }

        /**
     * 根据部门ID删除部门
     *
     * @param id 部门ID
     * @return 删除是否成功
     */
    @Override
    public boolean delete(int id) {
        return deptDao.delete(id) > 0;
    }

}
